<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends HomeController {

	//系统首页
    public function index(){
    

        $id   = $_SESSION['onethink_home']['uid'];
        
		//file_put_contents('ddd.txt',var_export($id,true),FILE_APPEND);  

        $num  = D('Message') ->showNum($id);
		
        $this ->assign('num',$num);
		
        $data = D('Index') -> showUid($id);
		
        $this ->assign('data',$data);

		

		$lcourses = D('Course') -> userCourses(session('uid'), 1,'','',1);

		$tcourses = D('Course') -> userCourses(session('uid'), 2,'','',1);
		$user = D('UserMember')->showUser(session('uid'));
		$ln = $tn = 0;

		if($user['end_teach'] == 0 && count($tcourses)>0){

			$tn = 1;

		}

		

		if($user['end_study'] == 0 && count($lcourses)>0){

			$ln = 1;

		}

		

		$this ->assign('ln',$ln);

		$this ->assign('tn',$tn);

		

        $this->display();
    }
 	public function ajaxTiaoz(){

 		$uid = session('uid');

 		$info = D('Auth') ->showFinds($uid);

 		if($info){

 			$this ->ajaxReturn(1);

 		}else{

 			$this ->ajaxReturn("您还没有进行身份认证");

 		}

 	}
}